/*
 * my_seq_test.c
 *
 *  Created on: 21/01/2012
 *      Author: rgurevit
 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include "seq.h"


int main() {
	//test1:
	//0-1-2-3-4-//
	//change curr to 15
	//change mode to geo
	//get 5 next
	//should be: 15,30,60,120,240
	int fd = open("/dev/seq0", O_RDWR);
	int buf[5];
	printf("open status: %d\n",fd);
	read(fd, buf, 5);
	printf ("should be: 0 1 2 3 4\n");
	for (int i = 0; i < 5; i++) {
		printf("%d ", buf[i]);
	}
	printf("\n");

	unsigned int cur_val = 15;
	write(fd, &cur_val, sizeof(cur_val));

	ioctl(fd, SEQ_CHG_MOD, GEOM_MODE);

	read(fd, buf, 5);
	printf ("should be: 15,30,60,120,240\n");
	for (int i = 0; i < 5; i++) {
		printf("%d ", *(buf + i));
	}
	printf("\n");

	//test 2:
	//change q to zero- should fail
	return 0;
}
